Replace zap/pingcap logging with standard library slog#2
Merged
kyleconroy merged 1 commit intomainfrom Apr 26, 2026
Merged
Conversation
Switch the two logging call sites in terror and charset over to the standard library's log/slog so we can drop the zap and pingcap/log dependencies. Stack traces now go through runtime/debug.Stack(), and the previous log.Fatal call becomes slog.Error followed by os.Exit(1).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates the codebase from using the
pingcap/logwrapper aroundgo.uber.org/zapto the standard library'slog/slogpackage. This reduces external dependencies and leverages Go's built-in structured logging capabilities.Key Changes
github.com/pingcap/logandgo.uber.org/zapwithlog/slogslogAPI:log.Warn()→slog.Warn()log.Error()→slog.Error()log.Debug()→slog.Debug()log.Fatal()→slog.Error()+os.Exit(1)zap.String()→slog.String()zap.Int()→slog.Int()zap.Error()→slog.Any("error", err)zap.Stack()→slog.String("stack", string(debug.Stack()))github.com/pingcap/logandgo.uber.org/zapfrom go.modterror/terror.goandcharset/charset.goNotable Implementation Details
runtime/debug.Stack()instead of relying on zap's automatic stack captureMustNil()function now callsos.Exit(1)after logging instead of usinglog.Fatal()to maintain the same behaviorhttps://claude.ai/code/session_01YLqL18zVJuHKeozjDQtb1u